//
//  CocOthAppController.h
//  GameTree
//
//  Created by BrunoCausse on 14/11/10.
//  Copyright 2010-2013 poulailler cie. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@class BC_GameTreeController;
@class BC_BoardController;
@class BC_Board;
@class BC_Move;

@class BC_Zoo;
@class BC_ZooRequest;

@interface CocOthAppController : NSObject {
	
	IBOutlet BC_GameTreeController	*gameTreeController;
	IBOutlet BC_BoardController		*boardController;
	
	NSSavePanel						*savePanel;
	IBOutlet NSView					*accessoryView;
	IBOutlet NSMatrix				*fileType;

	IBOutlet NSMenuItem				*menuConnect;
	IBOutlet NSMenuItem				*menuliste;
	IBOutlet NSMenuItem				*menuSolve;
	IBOutlet NSMenuItem				*menuSolveScript;

	IBOutlet NSMenuItem				*menuForward;
	IBOutlet NSMenuItem				*menuBackstep;
	
	NSURL							*urlCurrent;	// 10.6
	NSString						*path;			// 10.5
	NSInteger						saveType;
	
	BC_Zoo							*theZoo;
	

}

@property (readwrite, retain) NSURL *urlCurrent;
@property (readwrite, copy) NSString *path;


- (IBAction)newTree:(id)sender;
- (IBAction)saveTree:(id)sender;
- (IBAction)saveAsTree:(id)sender;
- (IBAction)openTree:(id)sender;

- (IBAction)addPathExtensionChoice:(id)sender;

- (void)openFile:(NSString *)filename;

- (IBAction)paste:(id)sender;
- (void)readFromPasteboard:(NSPasteboard *)pb;

- (IBAction)copy:(id)sender;
- (void)writeToPasteboard:(NSPasteboard *)pb;

//menu Zoo
- (IBAction)connect:(id)sender;
- (IBAction)liste:(id)sender;
- (IBAction)solve:(id)sender;
- (IBAction)solveScript:(id)sender;

#pragma mark menu methods

- (IBAction)forward:(id)sender;
- (BOOL)keyForward;
- (IBAction)backstep:(id)sender;
- (BOOL)keyBackstep;

- (void)setEnabledMenuForward:(BOOL)enabled;
- (void)setEnabledMenuBackstep:(BOOL)enabled;

#pragma mark liaison Browser methods

- (NSString *)nameVariation:(int)sq;
- (NSString *)scoreVariation:(int)sq;
- (void)addMove:(BC_Move *)move;
- (void)removeVariationAtSquare:(int)sq;
- (void)setTag:(int)tag atSquare:(int)sq;
- (int)tagAtSquare:(int)sq;

- (void)addMoveAndPlay:(BC_Move *)move;

- (void)tryParseString:(NSString *)pString;
- (BOOL)tryParseStringFromScript:(NSString *)pString;

- (void)startAnimation;
- (void)stopAnimation;


#pragma mark liaison board methods

- (BC_Board *)board;
- (void)setBoard:(BC_Board *)newBoard;

- (void)doMove:(BC_Move *)move;
- (void)undoMove:(BC_Move *)move;
- (void)needsDisplay;

#pragma mark Zoo methods

-(void)stopZoo;

-(void)disconnect;
-(void)zooDidFinishLaunching;
-(void)zooWillClose;

- (void)addVariationFromRequest:(BC_ZooRequest *)aRequest;

@end
